package com.ys.controller.web.storage;

import com.ys.config.MenuId;
import com.ys.dto.SubGridConfigDto;
import com.ys.entity.storage.TccLogisticsDetailChannelFee;
import com.ys.service.storage.TccLogisticsDetailChannelFeeService;
import com.ys.service.sys.CommonApiService;
import com.ys.vo.W;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/web/storage/tccLogisticsDetailChannelFee")
public class WebTccLogisticsDetailChannelFeeController {
	private static final Logger logger = LoggerFactory.getLogger(WebTccLogisticsDetailChannelFeeController.class);

	@Autowired
	private CommonApiService<TccLogisticsDetailChannelFee> commonApiService;
	@Autowired
	private TccLogisticsDetailChannelFeeService tccLogisticsDetailChannelFeeService;

	private final Long MENU_ID = MenuId.TCC_LogisticsDetailChannelFee;



	/*
	 * 编辑
	 */
	@GetMapping("/toDetail")
	public String toEdit(Model model, HttpServletRequest request, HttpServletResponse response, String logInvoiceNo) {
		try {
			TccLogisticsDetailChannelFee tccLogisticsDetailChannelFee = new TccLogisticsDetailChannelFee().setLogInvoiceNo(logInvoiceNo).queryFirst();
			if (tccLogisticsDetailChannelFee == null){
				return W.error(model, "物流渠道费用详情不存在");
			}
			//主表信息
			//Map<String, Object> extraParam = tccLogisticsDetailChannelFeeService.getExtraParam(bid);
			return commonApiService.toDetail(model,tccLogisticsDetailChannelFee.getId(), new TccLogisticsDetailChannelFee(), MENU_ID, null, null);
		}catch (Exception e) {
			logger.error("编辑页面出错：",e.getMessage(),e);
			return W.error(model, e.getMessage());
		}
	}

}